<?php
session_start();
require_once("includes/header.php");
?>

<?php

if (!empty($_SESSION['username'])) {
    echo "Welcome!   ";
    echo $_SESSION['username'];
} else {
    echo "You need to log in. Now redirect to Login Page...";
    echo "<script language=\"JavaScript\">
window.setTimeout(\"location='login.php'\", 1500);
</script>";
}
?>
<!-- Custom styles for this template -->

<div class="container">
    <div class="row">
        <div class="col-sm-9 col-md-7 col-lg-5 mx-auto">
            <div class="card card-signin my-5">
                <div class="card-body">
                    <h5 class="card-title text-center">Enter Fitness Record</h5>
                    <form class="text-center border border-light p-5" method="post" action="fitness_log.php">

                        <div class="form-label-group">
                            <!-- Subject -->
                            <select class="browser-default custom-select mb-4" name="type">
                                <option value="" disabled>Choose option</option>
                                <option value="dancing" selected>Dancing</option>
                                <option value="walking">Walking</option>
                                <option value="walkingdog">Walking Dog</option>
                            </select>
                        </div>

                        <div class="form-label-group">
                            <input type="number" name="weight" class="form-control mb-4" min="5" max="200"
                                   step="0.5" placeholder="Weight"
                                   required>
                        </div>

                        <div class="form-label-group">
                            <input type="number" name="age" class="form-control mb-4" placeholder="age" min="5"
                                   max="120" step="1"
                                   required>

                        </div>

                        <div class="form-label-group">
                            <input type="number" name="bmi" class="form-control mb-4" placeholder="bmi" min="0"
                                   max="100"
                                   required>

                        </div>

                        <div class="form-label-group">
                            <input type="number" name="record" class="form-control mb-4"
                                   placeholder="today exercise duration(minutes)"
                                   min="0" step="1" required>

                        </div>

                        <div class="form-label-group">
                            <input type="number" name="goal" class="form-control mb-4"
                                   placeholder="weekly goal (minutes)"
                                   min="0" step="1" required>

                        </div>
                        <button class="btn btn-lg btn-primary btn-block text-uppercase" type="submit">Submit</button>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

<?php
require_once("includes/footer.php");
?>
